//Replication files for Owsiak, Andrew P., and John A. Vasquez. 2021. Peaceful Dyads: A Territorial Perspective. International Interactions.

use "peaceful dyads replication.dta", replace

//This replication file uses the firthlogit package, which users may need to install.
//All analyses run in Stata 15.

//Table 1. Text only. No replication.

//Table 2. 
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 if rel_everpolrel2==1
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 rel_meancinc2 rel_meantrade2 if rel_everpolrel2==1
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 if rel_anymidsall==1
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 rel_meancinc2 rel_meantrade2 if rel_anymidsall==1

//Table 3.
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 if rel_everpolrel3==1
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 rel_meancinc3 rel_meantrade3 if rel_everpolrel3==1
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 if rel_anymidsall==1
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 rel_meancinc3 rel_meantrade3 if rel_anymidsall==1

//Table 4. Note focus on peaceful dyads; for space, pull only second row of the crosstab (i.e., the peaceful dyads).
tab rel_neverwar2 rel_anyterrmids2 if rel_everpolrel2==1, r chi2 lrchi2
tab rel_neverwar3 rel_anyterrmids3 if rel_everpolrel3==1, r chi2 lrchi2
tab rel_neverwar2 rel_anyterrmids2 if rel_anymidsall==1, r chi2 lrchi2
tab rel_neverwar3 rel_anyterrmids3 if rel_anymidsall==1, r chi2 lrchi2

//Table 5. Note focus on peaceful dyads; for space, pull only second row of the crosstab (i.e., the peaceful dyads).
tab rel_neverwar2 rel_alwaysjtdem2 if rel_everpolrel2==1, r chi2 lrchi2
tab rel_neverwar3 rel_alwaysjtdem3 if rel_everpolrel3==1, r chi2 lrchi2
tab rel_neverwar2 rel_alwaysjtdem2 if rel_anymidsall==1, r chi2 lrchi2
tab rel_neverwar3 rel_alwaysjtdem3 if rel_anymidsall==1, r chi2 lrchi2

//Table 6. Note focus on democratic dyads; for space, pull only second row of the crosstab (i.e., the democratic dyads).
tab rel_alwaysjtdem2 rel_anyterrmids2 if rel_everpolrel2==1, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyterrmids3 if rel_everpolrel3==1, r chi2 lrchi2
tab rel_alwaysjtdem2 rel_anyterrmids2 if rel_anymidsall==1, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyterrmids3 if rel_anymidsall==1, r chi2 lrchi2

//Table 7. Note focus on democratic dyads; for space, pull only second row of the crosstab (i.e., the democratic dyads).
tab rel_alwaysjtdem2 rel_anyicowterr2 if rel_everpolrel2==1, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyicowterr3 if rel_everpolrel3==1, r chi2 lrchi2
tab rel_alwaysjtdem2 rel_anyicowterr2 if rel_anymidsall==1, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyicowterr3 if rel_anymidsall==1, r chi2 lrchi2

//Online Appendix.
//Table A1.
tab rel_anywarall
tab rel_anywar1
tab rel_anywar2
tab rel_anywar3

tab rel_anywarall if rel_everpolrelall==1
tab rel_anywar1 if rel_everpolrel1==1
tab rel_anywar2 if rel_everpolrel2==1
tab rel_anywar3 if rel_everpolrel3==1

tab rel_anywarall if rel_anymidsall==1
tab rel_anywar1 if rel_anymidsall==1
tab rel_anywar2 if rel_anymidsall==1
tab rel_anywar3 if rel_anymidsall==1

//Table A2.
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 
firthlogit rel_neverwar2 rel_anyterrmids2 rel_alwaysjtdem2 rel_meancinc2 rel_meantrade2 
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 
firthlogit rel_neverwar3 rel_anyterrmids3 rel_alwaysjtdem3 rel_meancinc3 rel_meantrade3 

//Table A3. 
tab rel_neverwar2 rel_anyterrmids2, r chi2 lrchi2
tab rel_neverwar3 rel_anyterrmids3, r chi2 lrchi2

//Table A4. 
tab rel_neverwar2 rel_alwaysjtdem2, r chi2 lrchi2
tab rel_neverwar3 rel_alwaysjtdem3, r chi2 lrchi2

//Table A5.
tab rel_alwaysjtdem2 rel_anyterrmids2, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyterrmids3, r chi2 lrchi2

//Table A6.
tab rel_alwaysjtdem2 rel_anyicowterr2, r chi2 lrchi2
tab rel_alwaysjtdem3 rel_anyicowterr3, r chi2 lrchi2

//Table A7.
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall 
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall rel_meancincall rel_meantradeall 
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall if rel_everpolrelall==1
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall rel_meancincall rel_meantradeall if rel_everpolrelall==1
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall if rel_anymidsall==1 
firthlogit rel_neverwarall rel_anyterrmidsall rel_alwaysjtdemall rel_meancincall rel_meantradeall if rel_anymidsall==1

//Table A8.
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1 
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1 rel_meancinc1 rel_meantrade1
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1  if rel_everpolrel1==1
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1 rel_meancinc1 rel_meantrade1 if rel_everpolrel1==1
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1  if rel_anymidsall==1 
firthlogit rel_neverwar1 rel_anyterrmids1 rel_alwaysjtdem1 rel_meancinc1 rel_meantrade1 if rel_anymidsall==1

//Table A9.
tab rel_neverwarall rel_anyterrmidsall, r chi2 lrchi2
tab rel_neverwar1 rel_anyterrmids1, r chi2 lrchi2
tab rel_neverwarall rel_anyterrmidsall if rel_everpolrelall==1, r chi2 lrchi2 
tab rel_neverwar1 rel_anyterrmids1 if rel_everpolrel1==1, r chi2 lrchi2  
tab rel_neverwarall rel_anyterrmidsall if rel_anymidsall==1, r chi2 lrchi2 
tab rel_neverwar1 rel_anyterrmids1 if rel_anymidsall==1, r chi2 lrchi2 

//Table A10.
tab rel_neverwarall rel_alwaysjtdemall, r chi2 lrchi2
tab rel_neverwar1 rel_alwaysjtdem1, r chi2 lrchi2
tab rel_neverwarall rel_alwaysjtdemall if rel_everpolrelall==1, r chi2 lrchi2 
tab rel_neverwar1 rel_alwaysjtdem1 if rel_everpolrel1==1, r chi2 lrchi2  
tab rel_neverwarall rel_alwaysjtdemall if rel_anymidsall==1, r chi2 lrchi2 
tab rel_neverwar1 rel_alwaysjtdem1 if rel_anymidsall==1, r chi2 lrchi2 

//Table A11.
tab  rel_alwaysjtdemall rel_anyterrmidsall, r chi2 lrchi2
tab  rel_alwaysjtdem1 rel_anyterrmids1, r chi2 lrchi2
tab  rel_alwaysjtdemall rel_anyterrmidsall if rel_everpolrelall==1, r chi2 lrchi2 
tab  rel_alwaysjtdem1 rel_anyterrmids1 if rel_everpolrel1==1, r chi2 lrchi2  
tab  rel_alwaysjtdemall rel_anyterrmidsall if rel_anymidsall==1, r chi2 lrchi2 
tab  rel_alwaysjtdem1 rel_anyterrmids1 if rel_anymidsall==1, r chi2 lrchi2 

//Appendix B. 
//Table B1.
firthlogit rel_neverwar2 rel_anyterrmids2 rel_everjtdem2 rel_meancinc2 rel_meantrade2
firthlogit rel_neverwar3 rel_anyterrmids3 rel_everjtdem3 rel_meancinc3 rel_meantrade3
firthlogit rel_neverwar2 rel_anyterrmids2 rel_everjtdem2 rel_meancinc2 rel_meantrade2 if rel_everpolrel2==1
firthlogit rel_neverwar3 rel_anyterrmids3 rel_everjtdem3 rel_meancinc3 rel_meantrade3 if rel_everpolrel3==1
firthlogit rel_neverwar2 rel_anyterrmids2 rel_everjtdem2 rel_meancinc2 rel_meantrade2 if rel_anymidsall==1
firthlogit rel_neverwar3 rel_anyterrmids3 rel_everjtdem3 rel_meancinc3 rel_meantrade3 if rel_anymidsall==1

//Table B2.
tab rel_neverwar2 rel_everjtdem2, r chi2 lrchi2 
tab rel_neverwar3 rel_everjtdem3, r chi2 lrchi2 
tab rel_neverwar2 rel_everjtdem2 if rel_everpolrel2==1, r chi2 lrchi2 
tab rel_neverwar3 rel_everjtdem3 if rel_everpolrel3==1, r chi2 lrchi2 
tab rel_neverwar2 rel_everjtdem2 if rel_anymidsall==1, r chi2 lrchi2 
tab rel_neverwar3 rel_everjtdem3 if rel_anymidsall==1, r chi2 lrchi2 

//Table B3.
tab  rel_everjtdem2 rel_anyterrmids2, r chi2 lrchi2
tab  rel_everjtdem3 rel_anyterrmids3, r chi2 lrchi2
tab  rel_everjtdem2 rel_anyterrmids2 if rel_everpolrel2==1, r chi2 lrchi2 
tab  rel_everjtdem3 rel_anyterrmids3 if rel_everpolrel3==1, r chi2 lrchi2  
tab  rel_everjtdem2 rel_anyterrmids2 if rel_anymidsall==1, r chi2 lrchi2 
tab  rel_everjtdem3 rel_anyterrmids3 if rel_anymidsall==1, r chi2 lrchi2 

//Table B4.
firthlogit rel_neverfatalmids2 rel_anyterrmids2 rel_alwaysjtdem2 rel_meancinc2 rel_meantrade2
firthlogit rel_neverfatalmids3 rel_anyterrmids3 rel_alwaysjtdem3 rel_meancinc3 rel_meantrade3
firthlogit rel_neverfatalmids2 rel_anyterrmids2 rel_alwaysjtdem2 rel_meancinc2 rel_meantrade2 if rel_everpolrel2==1
firthlogit rel_neverfatalmids3 rel_anyterrmids3 rel_alwaysjtdem3 rel_meancinc3 rel_meantrade3 if rel_everpolrel3==1

//Table B5.
tab rel_neverfatalmids2 rel_anyterrmids2, r chi2 lrchi2 
tab rel_neverfatalmids3 rel_anyterrmids3, r chi2 lrchi2 
tab rel_neverfatalmids2 rel_anyterrmids2 if rel_everpolrel2==1, r chi2 lrchi2 
tab rel_neverfatalmids3 rel_anyterrmids3 if rel_everpolrel3==1, r chi2 lrchi2

//Table B6.
tab rel_neverfatalmids2 rel_alwaysjtdem2, r chi2 lrchi2 
tab rel_neverfatalmids3 rel_alwaysjtdem3, r chi2 lrchi2 
tab rel_neverfatalmids2 rel_alwaysjtdem2 if rel_everpolrel2==1, r chi2 lrchi2 
tab rel_neverfatalmids3 rel_alwaysjtdem3 if rel_everpolrel3==1, r chi2 lrchi2

//Table B7.
use "mid escalation.dta", replace
firthlogit peace territory jtdem if flagwar==0 & per2==1
firthlogit peace territory jtdem cincratio totaltrade if flagwar==0 & per2==1 
firthlogit peace territory jtdem if flagwar==0 & per3==1
firthlogit peace territory jtdem cincratio totaltrade if flagwar==0 & per3==1 

//Table B8. Take peace rows (war=0).
tab war territory if per2==1, r chi2 lrchi2
tab war territory if per3==1, r chi2 lrchi2
tab war jtdem if per2==1, r chi2 lrchi2
tab war jtdem if per3==1, r chi2 lrchi2

//Table B9. Take peace rows (fatalmid=0).
tab fatalmid territory if per2==1, r chi2 lrchi2
tab fatalmid territory if per3==1, r chi2 lrchi2
tab fatalmid jtdem if per2==1, r chi2 lrchi2
tab fatalmid jtdem if per3==1, r chi2 lrchi2

//Data and empirical references
// Barbieri, Katherine, Omar M. G. Keshk, and Brian Pollins. 2009. “TRADING DATA: Evaluating our Assumptions and Coding Rules.” Conflict Management and Peace Science 26 (5): 471-491.
// Correlates of War Project.
// Firth, David. 1993. “Bias Reduction of Maximum Likelihood Estimates.” Biometrika 80 (l): 27-38. 
// Frederick, Bryan A., Paul R. Hensel, and Christopher Macaulay. 2017. “The Issue Correlates of War Territorial Claims Data, 1816-2001.” Journal of Peace Research 54 (1): 99-108.
// Marshall, Monty G., Ted Robert Gurr, and Keith Jaggers. 2017. “Polity IV Project: Dataset User’s Manual.” Online at: http://www.systemicpeace.org/inscr/p4manualv2016.pdf.
// Palmer, Glenn, Vito D'Orazio, Michael Kenwick, and Matthew Lane. 2015. “The MID4 Data Set: Procedures, Coding Rules, and Description.” Conflict Management and Peace Science 32 (2): 222-242.
// Sarkees, Meredith R., and Frank Wayman. 2010. Resort to War: 1816-2007. Washington DC: CQ Press.
// Senese, Paul D., and John A. Vasquez. 2008. The Steps to War. Princeton: Princeton University Press.
// Singer, J. David. 1987. “Reconstructing the Correlates of War Dataset on Material Capabilities of States, 1816–1995.” International Interactions 14 (2): 115–132.
